package com.ddstation.waste_delivery.service;

import com.ddstation.waste_delivery_api.mapper.DtWasteDeliveryYunBangApiMapper;
import com.ddstation.waste_delivery_api.model.WasteDeliveryApiInModel;
import com.ddstation.waste_delivery_api.service.WasteDeliveryYunbangAPIService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.spring.annotation.MapperScan;

import javax.inject.Inject;
import java.util.List;

@Service @Lazy
@MapperScan("com.ddstation.waste_delivery_api.mapper")
public class WasteDeliveryYunbangAPIServiceImpl implements WasteDeliveryYunbangAPIService {

    @Override
    @Transactional(rollbackFor = Exception.class)
    public String insertList(List<WasteDeliveryApiInModel> list){
        try {
            dtWasteDeliveryYunBangApiMapper.insertList(list);
        } catch ( Exception e){
            log.error(e.getMessage());
            return e.getMessage();
        }
        return "";
    }

    private Logger log = LoggerFactory.getLogger(this.getClass());
    @Inject private DtWasteDeliveryYunBangApiMapper dtWasteDeliveryYunBangApiMapper;
}
